package com.xywl.escort.adapter;

import android.support.annotation.Nullable;
import android.support.v4.content.ContextCompat;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.xywl.escort.R;
import com.xywl.escort.bean.UserFundsListResp;

import java.util.List;

public class FundRecordsAdapter extends BaseQuickAdapter<UserFundsListResp.DataBean.ListBean, BaseViewHolder> {
    public FundRecordsAdapter(int layoutResId, @Nullable List<UserFundsListResp.DataBean.ListBean> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, UserFundsListResp.DataBean.ListBean item) {
        TextView textTitle = helper.getView(R.id.text_title);
        // 操作类型(1:充值,2:提现,3认购,4:收购,5:转卖，6.采购，7.平台退款)
        switch (item.operateType) {
            case 1:
                textTitle.setText("充值");
                break;
            case 2:
                textTitle.setText("提现");
                break;
            case 3:
                textTitle.setText("认购产品");
                break;
            case 4:
                textTitle.setText("认购产品平台收购");
                break;
            case 5:
                textTitle.setText("认购产品转卖");
                break;
            case 6:
                textTitle.setText("商场采购");
                break;
            case 7:
                textTitle.setText("平台退款");
            default:
                break;
        }

        helper.setText(R.id.text_time, item.createTime);
        // 资金流向针对个人(0:入账资金,1:出账资金)
        String money = item.moneyYuan;
        TextView textMoney = helper.getView(R.id.text_money);
        switch (item.fundsFlowType) {
            case 0:
                textMoney.setText("+".concat(money));
                textMoney.setTextColor(ContextCompat.getColor(mContext, R.color.normal_text_color));
                break;
            case 1:
                textMoney.setText("-".concat(money));
                textMoney.setTextColor(ContextCompat.getColor(mContext, R.color.main_body_prompt_color));
                break;
            default:
                break;
        }
    }
}
